var connect = require('connect');

function logger(req, res, next) { // 总是调用next(), 所以后续中间件总会被调用
  console.log('%s %s', req.method, req.url);
  next();
}

function hello(req, res) { // 不会调用next(), 因为组件响应了请求
  res.setHeader('Content-Type', 'text/plain');
  res.end('hello world');
}

var app = connect.use(logger).use(hello).listen(3000);

